Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[36467] Add API users form and schema endpoints #9090

Merged
merged 21 commits into from
Mar 23, 2021
Merged

[36467] Add API users form and schema endpoints #9090

merged 21 commits into from
Mar 23, 2021

Conversation

oliverguenther
Copy link
Member

@oliverguenther oliverguenther commented Mar 15, 2021

  • Create form POST /api/v3/users/form
  • Update form POST /api/v3/users/:id/form
  • Users schema /api/v3/users/schema
  • Extend custom fields to UserRepresenter

Attribute conversion fixes

firstName and lastName of user were not correctly converted to the frontend. That resulted in validationErrors properties containing the backend keys firstname and lastname. This has been fixed.

Representable nil patch
A patch is added for representable to fix trailblazer/representable#234, since Setter is not being applied when the input is nil.

https://community.openproject.com/work_packages/36467

@oliverguenther oliverguenther changed the title Add API users form and schema endpoints [36467] Add API users form and schema endpoints Mar 15, 2021
@oliverguenther oliverguenther marked this pull request as ready for review March 15, 2021 20:13
@oliverguenther oliverguenther force-pushed the users-form-api branch 2 times, most recently from bcb534a to 1edabd7 Compare March 17, 2021 07:07
Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from what I noted down in code, these are the things I noted when using the API

  • The name property is not described in the schema
  • firstName and lastName are described as non writable
  • The password property is described although it does not exist on the user resource
  • Attributes turn up in the form's payload although they are not writable (e.g. name):

image

config/constants/ar_to_api_conversions.rb Outdated Show resolved Hide resolved
app/contracts/users/base_contract.rb Outdated Show resolved Hide resolved
docs/api/apiv3/endpoints/users.apib Show resolved Hide resolved
docs/api/apiv3/endpoints/users.apib Show resolved Hide resolved
docs/api/apiv3/endpoints/users.apib Outdated Show resolved Hide resolved
docs/api/apiv3/endpoints/users.apib Show resolved Hide resolved
docs/api/apiv3/endpoints/users.apib Outdated Show resolved Hide resolved
docs/api/apiv3/endpoints/users.apib Show resolved Hide resolved
@oliverguenther
Copy link
Member Author

The password property is described although it does not exist on the user resource

The password property is a write-only property so it's not contained in the payload. It can still be set and written as per the schema

@oliverguenther
Copy link
Member Author

@ulferts I believe addressed all remarks

Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The property email has the key mail in the schema

  • In the API description, the :id part is missing from the routes:
    image

  • In the API description, the schema example seems to be malformed:

image

  • The endpoint for user update is wrong (lacking the {id} part)

image

Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Thanks for fixing the user API description along the way.

@ulferts ulferts merged commit 065dfbd into dev Mar 23, 2021
@ulferts ulferts deleted the users-form-api branch March 23, 2021 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Parsing null values results in property being set despite reader property present
2 participants